{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>product_id</th>\n",
       "      <th>name</th>\n",
       "      <th>wholesale_price</th>\n",
       "      <th>retail_price</th>\n",
       "      <th>sales</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>23</td>\n",
       "      <td>computer</td>\n",
       "      <td>500.0</td>\n",
       "      <td>1000</td>\n",
       "      <td>100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>96</td>\n",
       "      <td>Python Workout</td>\n",
       "      <td>35.0</td>\n",
       "      <td>75</td>\n",
       "      <td>1000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>97</td>\n",
       "      <td>Pandas Workout</td>\n",
       "      <td>35.0</td>\n",
       "      <td>75</td>\n",
       "      <td>500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>15</td>\n",
       "      <td>banana</td>\n",
       "      <td>0.5</td>\n",
       "      <td>1</td>\n",
       "      <td>200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>87</td>\n",
       "      <td>sandwich</td>\n",
       "      <td>3.0</td>\n",
       "      <td>5</td>\n",
       "      <td>300</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   product_id            name  wholesale_price  retail_price  sales\n",
       "0          23        computer            500.0          1000    100\n",
       "1          96  Python Workout             35.0            75   1000\n",
       "2          97  Pandas Workout             35.0            75    500\n",
       "3          15          banana              0.5             1    200\n",
       "4          87        sandwich              3.0             5    300"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "from pandas import Series, DataFrame\n",
    "\n",
    "df = DataFrame([{'product_id':23, 'name':'computer', 'wholesale_price': 500, \n",
    "                 'retail_price':1000, 'sales':100},\n",
    "               {'product_id':96, 'name':'Python Workout', 'wholesale_price': 35,\n",
    "                'retail_price':75, 'sales':1000},\n",
    "               {'product_id':97, 'name':'Pandas Workout', 'wholesale_price': 35,\n",
    "                'retail_price':75, 'sales':500},\n",
    "               {'product_id':15, 'name':'banana', 'wholesale_price': 0.5,\n",
    "                'retail_price':1, 'sales':200},\n",
    "               {'product_id':87, 'name':'sandwich', 'wholesale_price': 3,\n",
    "                'retail_price':5, 'sales':300},\n",
    "               ])\n",
    "\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "df['current_net'] = ((df['retail_price'] - df['wholesale_price']) * df['sales'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>product_id</th>\n",
       "      <th>name</th>\n",
       "      <th>wholesale_price</th>\n",
       "      <th>retail_price</th>\n",
       "      <th>sales</th>\n",
       "      <th>current_net</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>23</td>\n",
       "      <td>computer</td>\n",
       "      <td>500.0</td>\n",
       "      <td>1000</td>\n",
       "      <td>100</td>\n",
       "      <td>50000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>96</td>\n",
       "      <td>Python Workout</td>\n",
       "      <td>35.0</td>\n",
       "      <td>75</td>\n",
       "      <td>1000</td>\n",
       "      <td>40000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>97</td>\n",
       "      <td>Pandas Workout</td>\n",
       "      <td>35.0</td>\n",
       "      <td>75</td>\n",
       "      <td>500</td>\n",
       "      <td>20000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>15</td>\n",
       "      <td>banana</td>\n",
       "      <td>0.5</td>\n",
       "      <td>1</td>\n",
       "      <td>200</td>\n",
       "      <td>100.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>87</td>\n",
       "      <td>sandwich</td>\n",
       "      <td>3.0</td>\n",
       "      <td>5</td>\n",
       "      <td>300</td>\n",
       "      <td>600.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   product_id            name  wholesale_price  retail_price  sales  \\\n",
       "0          23        computer            500.0          1000    100   \n",
       "1          96  Python Workout             35.0            75   1000   \n",
       "2          97  Pandas Workout             35.0            75    500   \n",
       "3          15          banana              0.5             1    200   \n",
       "4          87        sandwich              3.0             5    300   \n",
       "\n",
       "   current_net  \n",
       "0      50000.0  \n",
       "1      40000.0  \n",
       "2      20000.0  \n",
       "3        100.0  \n",
       "4        600.0  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "df['after_15'] = df['current_net'] * 0.85\n",
    "df['after_20'] = df['current_net'] * 0.80\n",
    "df['after_25'] = df['current_net'] * 0.75\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>product_id</th>\n",
       "      <th>name</th>\n",
       "      <th>wholesale_price</th>\n",
       "      <th>retail_price</th>\n",
       "      <th>sales</th>\n",
       "      <th>current_net</th>\n",
       "      <th>after_15</th>\n",
       "      <th>after_20</th>\n",
       "      <th>after_25</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>23</td>\n",
       "      <td>computer</td>\n",
       "      <td>500.0</td>\n",
       "      <td>1000</td>\n",
       "      <td>100</td>\n",
       "      <td>50000.0</td>\n",
       "      <td>42500.0</td>\n",
       "      <td>40000.0</td>\n",
       "      <td>37500.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>96</td>\n",
       "      <td>Python Workout</td>\n",
       "      <td>35.0</td>\n",
       "      <td>75</td>\n",
       "      <td>1000</td>\n",
       "      <td>40000.0</td>\n",
       "      <td>34000.0</td>\n",
       "      <td>32000.0</td>\n",
       "      <td>30000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>97</td>\n",
       "      <td>Pandas Workout</td>\n",
       "      <td>35.0</td>\n",
       "      <td>75</td>\n",
       "      <td>500</td>\n",
       "      <td>20000.0</td>\n",
       "      <td>17000.0</td>\n",
       "      <td>16000.0</td>\n",
       "      <td>15000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>15</td>\n",
       "      <td>banana</td>\n",
       "      <td>0.5</td>\n",
       "      <td>1</td>\n",
       "      <td>200</td>\n",
       "      <td>100.0</td>\n",
       "      <td>85.0</td>\n",
       "      <td>80.0</td>\n",
       "      <td>75.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>87</td>\n",
       "      <td>sandwich</td>\n",
       "      <td>3.0</td>\n",
       "      <td>5</td>\n",
       "      <td>300</td>\n",
       "      <td>600.0</td>\n",
       "      <td>510.0</td>\n",
       "      <td>480.0</td>\n",
       "      <td>450.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   product_id            name  wholesale_price  retail_price  sales  \\\n",
       "0          23        computer            500.0          1000    100   \n",
       "1          96  Python Workout             35.0            75   1000   \n",
       "2          97  Pandas Workout             35.0            75    500   \n",
       "3          15          banana              0.5             1    200   \n",
       "4          87        sandwich              3.0             5    300   \n",
       "\n",
       "   current_net  after_15  after_20  after_25  \n",
       "0      50000.0   42500.0   40000.0   37500.0  \n",
       "1      40000.0   34000.0   32000.0   30000.0  \n",
       "2      20000.0   17000.0   16000.0   15000.0  \n",
       "3        100.0      85.0      80.0      75.0  \n",
       "4        600.0     510.0     480.0     450.0  "
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "current_net    110700.0\n",
       "after_15        94095.0\n",
       "after_20        88560.0\n",
       "after_25        83025.0\n",
       "dtype: float64"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[['current_net', 'after_15', 'after_20', 'after_25']].sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "current_net        0.0\n",
       "after_15       16605.0\n",
       "after_20       22140.0\n",
       "after_25       27675.0\n",
       "dtype: float64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['current_net'].sum() - df[['current_net', 'after_15', 'after_20', 'after_25']].sum()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
